# coding=utf-8
from rest_framework import serializers
from sutras.models import (UserTranscription as ModelUserTranscription,
                           SutraEdition as ModelSutraEdition,
                           UserLayout as ModelUserLayout,
                           Temple as ModelTemple,
                           PrintOrder as ModelPrintOrder,
                           PrintOrderDetail as ModelPrintOrderDetail)


class UserTranscriptionSerializer(serializers.ModelSerializer):

    class Meta:
        model = ModelUserTranscription


class SutraEditionSerializer(serializers.ModelSerializer):

    class Meta:
        model = ModelSutraEdition


class UserLayoutSerializer(serializers.ModelSerializer):

    class Meta:
        model = ModelSutraEdition


class TempleSerializer(serializers.ModelSerializer):

    class Meta:
        model = ModelTemple
        fields = ('id', 'name', 'img_url')


class PrintOrderDetailSerializer(serializers.ModelSerializer):
    name = serializers.CharField(source='temple.name')

    class Meta:
        model = ModelPrintOrderDetail
        fields = ('id', 'name', 'num')
